﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TI_BAL;


namespace TInventory
{
    public partial class Form1 : Form
    {
        TIEntities dbContext;
        public Form1()
        {
            InitializeComponent();
            dbContext = new TIEntities();
            LoadData();
        }
        public void LoadData()
        {
            

            List<Supplier> list = (from c in dbContext.Suppliers select c).ToList<Supplier>();
            dgViewSuppliers.DataSource = list;
               
        }
        public void UpdateSupplierAddress(string addres)
        {
            Supplier Supplier = (from c in dbContext.Suppliers where c.ID == 1 select c).FirstOrDefault();
            Supplier.SupplierAddress = addres;
            dbContext.SaveChanges();
        }
        public void AddSupplier(Supplier Supplier)
        {

            dbContext.AddToSuppliers(Supplier);
            dbContext.SaveChanges();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
